package com.xiaodoo.algorithm.binsearch;

import java.io.BufferedInputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Math1 {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<>();
        String put = map.put("a", "x");
        System.out.println(map.put("a", "b"));

        System.out.println("0xff".
                substring(2,3));
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        System.out.println(Integer.parseInt(s,16));
        String str = s.substring(2, s.length());
        char[] chars = str.toCharArray();
        int n = chars.length-1;
        for (int i = 0; i < chars.length/2; i++) {
            char tmp = chars[i];
            chars[i] = chars[n];
            chars[n] = tmp;
            n--;
        }
        int sum = 0;
        int j = 0;
        for (char c : chars) {
            if (c >= 'A' && c <= 'F') {
                sum += (c - 55) * Math.pow(16, j);
            } else {
                sum += c * Math.pow(16, j);
            }
            j++;
        }
        System.out.println(sum);


    }

    static void canDrinkNum(int n) {
        int num = 0;
        while (true) {
            n = n / 3;
            if (n >= 1) {
                num += n;
            } else {
                break;
            }
        }
        System.out.println(num);
    }
}